package jucTest;

import java.util.concurrent.TimeUnit;

public class WaitDemo {
    public static void main(String[] args) throws InterruptedException {
        //Resouces resource=new Resouces();
        //LockResource resource=new LockResource();
        SxResource resource = new SxResource();
        new Thread(() -> {
            for (int i = 0; i < 5; i++) {
                resource.get1();
            }
        }, "生产者1").start();

        new Thread(() -> {
            for (int i = 0; i < 5; i++) {
                resource.get2();
            }
        }, "生产者2").start();
        new Thread(() -> {
            for (int i = 0; i < 5; i++) {
                resource.get3();
            }
        }, "生产者3").start();
        new Thread(() -> {
            for (int i = 0; i < 5; i++) {
                resource.get4();
            }
        }, "生产者4").start();
    }
}
